<template>
	<div id="">
		<div class="">
			<el-button type="info" @click="showOptions">选项</el-button>
			<el-button type="primary" @click="getLuckyNumber">获取</el-button>
		</div>
		<div class="res"></div>
		<el-dialog v-model="isShowDialog">
			<el-checkbox v-model="form.random">随机因子</el-checkbox>
			<br />
			<el-checkbox-group v-model="form.self" :min="0" :max="5" id="option-checkbox">
				<div class="title">中奖率之最</div>
				<el-checkbox :disabled="form.random" label="highestWinningRateIn100">100</el-checkbox>
				<el-checkbox :disabled="form.random" label="highestWinningRateIn300">300</el-checkbox>
				<el-checkbox :disabled="form.random" label="highestWinningRateIn500">500</el-checkbox>
				<el-checkbox :disabled="form.random" label="highestWinningRateIn700">700</el-checkbox>
				<el-checkbox :disabled="form.random" label="highestWinningRateInAll">所有</el-checkbox>
				<div class="title">最高奖励</div>
				<el-checkbox :disabled="form.random" label="maximumRewardIn100">100</el-checkbox>
				<el-checkbox :disabled="form.random" label="maximumRewardIn300">300</el-checkbox>
				<el-checkbox :disabled="form.random" label="maximumRewardIn500">500</el-checkbox>
				<el-checkbox :disabled="form.random" label="maximumRewardIn700">700</el-checkbox>
				<el-checkbox :disabled="form.random" label="maximumRewardInAll">所有</el-checkbox>
				<div class="title">出现频率</div>
				<el-checkbox :disabled="form.random" label="frequentNumberIn100">100</el-checkbox>
				<el-checkbox :disabled="form.random" label="frequentNumberIn300">300</el-checkbox>
				<el-checkbox :disabled="form.random" label="frequentNumberIn500">500</el-checkbox>
				<el-checkbox :disabled="form.random" label="frequentNumberIn700">700</el-checkbox>
				<el-checkbox :disabled="form.random" label="frequentNumberInAll">所有</el-checkbox>
				
			</el-checkbox-group>
		</el-dialog>
	</div>
</template>

<script>
import { getInfo ,getTodayLuckyNumbers} from '@/api/superLotto.js';
export default {
	data() {
		return {
			isShowDialog: false,
			form: {
				random: false,
				self: []
				// //中奖率之最
				// highestWinningRateIn100:false,
				// highestWinningRateIn300:false,
				// highestWinningRateIn500:false,
				// highestWinningRateIn700:false,
				// highestWinningRateInAll:false,
				// //奖励之最
				// maximumRewardIn100:false,
				// maximumRewardIn300:false,
				// maximumRewardIn500:false,
				// maximumRewardIn700:false,
				// maximumRewardInAll:false,
				// //出现频率之最
				// frequentNumberIn100:false,
				// frequentNumberIn300:false,
				// frequentNumberIn500:false,
				// frequentNumberIn700:false,
				// frequentNumberInAll:false,
			}
		};
	},
	created() {
		getInfo().then(res => {
			console.log(res);
		});
	},
	methods: {
		showOptions() {
			this.isShowDialog = true;
		},
		getLuckyNumber() {
			this.$confirm('每天只能获取一次幸运号码，确定立即获取吗', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '再想想',
				type: 'warning'
			})
				.then(() => {
					let obj={}
					if(this.form.random){
						obj.random=true
					}else{
						this.form.self.forEach(item=>{
							obj[item]=1
						})
					}
					getTodayLuckyNumbers(obj).then(res=>{
						console.log(res)
					})
				})
				.catch(() => {});
		}
	}
};
</script>

<style lang="scss">
#option-checkbox {
	padding-top: 30px;
	.title {
		font-size: 16px;
		padding: 10px;
		color: red;
	}
}
</style>
